package supplierconsumer;

import java.util.Random;

public class Productor extends Thread{

	Container container;

	public Productor(String name, Container container) {
		super(name);
		this.container = container;
	}

	@Override
	public void run() {
		String[] name = {"三鲜","酸菜","萝卜","韭菜","鲅鱼"};
		
		for(int i = 1 ; i <= 5 ; i ++) {
			Dumpling d = new Dumpling(name[new Random().nextInt(name.length)]);
			System.out.println(this.getName()+"生产第" + i + "个饺子:" + d.getFilling());
			container.push(d);
			
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
